var $ = require('../../lib/jquery');
var util = require('./common/util');
var template = require('../tpl/template');
var nav = require('./common/nav');
var _header = require('./common/header');
var minHeight = require('./common/minHeight');
minHeight.init();
var jyqy_tab = require('./common/jy_common');
jyqy_tab.bindevent();
var _nav = new nav();
var header = new _header();
var otherAdvice = {
  bindevent: function () {
    var _this = this;
      $('.js_to_submit').on('click', function() {
        var value = $('.js_content').val();
        if (/^.{2,500}$/.test(value || '')) {
          _this.fetch(value);
        }else{
          alert('请输入2-500个正确文字，来进行评论')
        }
        
      })
      $('.js_index').on('click', function() {
        location.href = "./index.html";
      })
  },
  fetch: function (value) {
    util.fetch('api/medical/dock/medicalOpinion',{
      content: value
    }).then(function (){
      $('.js_content').val('');
        alert('提交成功');
    })
  }
}
otherAdvice.bindevent();